<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

$this->title = '账号详情';
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Users'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">

   <div class="box">
        <div class="box-header">
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        </div>
        <div class="box-body">

        <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'username',
                'email',
                'name',
                'code',
                [
                    'attribute' => 'company',
                    'value' => function($model){
                        $company = '';
                        $model->company = json_decode($model->company);
                        if($model->company){
                            foreach($model->company as $val){
                                $company .= \yii::$app->params['company'][$val].',';
                            }
                        }
                        return $company;
                    },
                ],
                'status',
                [
                    'attribute' => 'nation',
                    'value' => function ($model) {
                            return isset(Yii::$app->params['nation'][$model->nation])?Yii::$app->params['nation'][$model->nation]:'';
                        },
                ],
            ],
        ]) ?>
        </div>
    </div>

</div>
